<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>

<body>
    <div id="root">
    </div>
    <script>
        Vue.config.productionTip = false
        const student = Vue.extend({
            template: `
            <div><h2>我叫{{name}}</h2>
                <h2>我来自{{address}}</h2>
                </div>
            `,
            data() {
                return {
                    name: '申屠宇扬',
                    address: "长春光华学院"
                }
            },
        })
        const school = Vue.extend({
            // 注册给谁，在谁里面写结构
            template: `
            <div><h2>学校地址{{address}}</h2>
                <h2>所属省份{{province}}</h2>
                <student></student>             
                </div>
            `,
            data() {
                return {
                    address: '武汉路',
                    province: '吉林'
                }
            },
            components:{
                student
            }
        })
        const hello =  Vue.extend({
            template:`
            <div>
                <h1>同学们好 ，我是 {{name}}</h1>    
            </div>
            `,
            data(){
                return{
                    name:"尚硅谷"
                }
            }
        })
        const app = Vue.extend({
            template:`
            <div>
            <school></school>
            <hello></hello>
            </div>
            `,
            components:{
                school,
                hello
            }
        })
        var v = new Vue({
            template:'<app></app>',
            el: '#root',
            data: {},
            components: {
                app
            }
        })
    </script>
</body>

</html>